//
// Created by Semir on 2020/5/24.
//

#include <iostream>
#include <vector>
#include <string>
#include <set>

using namespace std;

vector<bool> vis;
set<string> resSet;

void PermutationDfs(const string& str, string& cur) {
    if (cur.length() == str.length()) {
        resSet.insert(cur);
        return;
    }
    for (int i = 0; i < str.length(); i++) {
        if (!vis[i]) {
            vis[i] = true;
            cur += str[i];
            PermutationDfs(str, cur);
            vis[i] = false;
            cur = cur.substr(0, cur.length() - 1);
        }
    }
}

vector<string> Permutation(string str) {
    vis.resize(str.length(), false);
    string cur;
    for (int i = 0; i < str.length(); i++) {
        cur = "";
        cur += str[i];
        vis[i] = true;
        PermutationDfs(str, cur);
        vis[i] = false;
    }
    vector<string> res(resSet.begin(), resSet.end());
    return res;
}

int main() {
    string str = "aa";
    vector<string> result = Permutation(str);
    cout << result.size() << endl;
    return 0;
}

